// npm i -S cookie-session
const express = require('express')
const cookieSession =require('cookie-session')
const app=express()
app.listen(8086)
app.use(express.static('../src'))
app.use(cookieSession({
    name:'sessionId',
    secret:'sad加密',
    maxAge:10*60*1000
}))
app.get('/',(req,res)=>{
    // 写session
    if(!req.session.view){
        req.session.view=1
    }else{
        req.session['view']++
    }
    res.send('访问了此页'+req.session.view+'次')
})
